﻿using DevExpress.XtraBars.Docking;
using DevExpress.XtraBars.Docking2010;
using DevExpress.XtraBars.Docking2010.Views;
using DevExpress.XtraBars.Docking2010.Views.Tabbed;
using DevExpress.XtraEditors;

namespace Com.OpenCode.Framework.DevForm
{
    public class DockManagerUI : DockManager
    {
        #region 构造函数

        public DockManagerUI(MainForm form)
        {
            Form = form.DockAreaControl;
            DocumentManager _DocumentManager = new DocumentManager {ContainerControl = form.DockAreaControl};
            TabbedView = new TabbedView(form.DockAreaControl.Container);
            _DocumentManager.View = TabbedView;
        }

        #endregion

        public TabbedView TabbedView { get; private set; }

        /// <summary>
        /// 新建一个Document刷新布局。
        /// </summary>
        public void RefreshLayout()
        {
            BaseDocument baseDocument = TabbedView.Controller.AddDocument(new XtraUserControl());
            TabbedView.Controller.Activate(baseDocument);
            TabbedView.Controller.Close(baseDocument);
        }

    }
}